package com.fileshare.web.controller.index.view;

import com.fileshare.web.controller.index.BaseController;
import com.fileshare.web.dto.Vo.UserVo;
import com.fileshare.web.service.EmailService;
import com.fileshare.web.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 首页
 */
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {

    @Resource
    private UserService userService;
    @Resource
    private EmailService emailService;

    @GetMapping("")
    public String userRank() {
        return view("user/rank");
    }

    @GetMapping(value = {"/{uerSeq}", "/{uerSeq}.html"})
    public String userHome(HttpServletRequest request, @PathVariable String uerSeq) {
        UserVo user = userService.getUserBySeq(uerSeq);
        request.setAttribute("user", user);
        return view("user/home");
    }

}
